{extend name="public:common_edit"/}
{block name="css"}
<style>
    .layout{
        min-height: 50px;
    }
    .ifrme{
        width: 500px;
        height: 500px;
        border: 2px solid rgba(102,102,102,0.3);
        border-radius: 3px;
        position: absolute;
        z-index: 999;
        box-shadow: 0 0 30px rgba(0,0,0,.5);
        background-color: white;
    }
</style>
    <link href="/public/plugs/switch-button/css/bootstrap-switch.css" rel="stylesheet">
{/block}
{block name="main"}
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title"><i class="fa fa-list"></i>{$title}</h3>
        </div>
        <div class="panel-body">
            <div class="navbar navbar-default">
                <form action="" id="search-form2" class="navbar-form form-inline" method="get" onsubmit="return false">
                    <label class="control-label" for="input-order-id">用户昵称</label>
                    <div class="input-group">
                        <input type="text" name="nick_name" value="{$Think.get.nick_name}" placeholder="用户昵称"
                               id="input-order-id" class="form-control">
                    </div>
                    <label class="control-label" for="input-order-id">状态</label>
                    <select class="form-control" name="status">
                        <option id="status3" value="">全部</option>
                        <option id="status1" value="1">正常</option>
                        <option id="status2" value="2">待认证</option>
                        <option id="status0" value="0">认证失败</option>
                    </select>
                    <button type="submit" onclick="javascript:document.getElementById('search-form2').submit();"
                            id="button-filter search-order" class="btn btn-primary"><i class="fa fa-search"></i> 筛选
                    </button>
                </form>
            </div>
            <div id="ajax_return">
                <form method="post" enctype="multipart/form-data" target="_blank" id="form-order">
                    <div class="table-responsive">
                        <table class="table table-bordered table-hover">
                            <thead>
                            <tr>
                                <td>id</td>
                                <td>用户昵称</td>
                                <td>用户头像</td>
                                <td>视频地址</td>
                                <td>播放次数</td>
                                <td>视频类型</td>
                                <td>视频状态</td>
                                <td>上传时间</td>
                                <td>操作</td>
                            </tr>
                            </thead>
                            <tbody>
                            <!-- 列表循环开始 -->
                            {volist name="rows" id="row"}
                            <tr>
                                <td>{$row.pid}</td>
                                <td>{$row.nick_name}</td>
                                <td><img src="{$row.header_img}" style="max-width: 100px" alt=""></td>
                                <td><div class="layout"><a target="_blank" href="{$row.play_url}">{$row.play_url}</a></div></td>
                                <td>{$row.play_num}</td>
                                <td>{if condition="$row.type == 1"} 视频动态 {else /} 认证视频 {/if}</td>
                                <td>{if condition="$row.status == 1"} 正常 {elseif condition="$row.status == 2"/} 认证中 {else /} 认证失败 {/if}</td>
                                <td>{$row.create_time}</td>
                                <td>
                                    {if condition="$row.type == 1"}
                                        {if condition="$row.status == 2"}
                                            <span class="btn btn-primary change" data-url="{:url('change',['id'=>$row.pid,'type'=>1])}">审核通过</span>
                                            <span class="btn btn-primary change" data-url="{:url('change',['id'=>$row.pid,'type'=>0])}">驳回</span>
                                        {/if}
                                    {/if}
                                    <span class="btn btn-danger check_del" data-url="{:url('delete',['id'=>$row['pid']])}">删除</span>
                                </td>
                            </tr>
                            {/volist}
                            <!-- 列表循环结束 -->
                            </tbody>
                        </table>
                    </div>
                </form>
            </div>
            <div id='pagerarea'>{$pageHTML}</div>
        </div>

    </div>
{/block}

{block name="js"}
<script src="/public/plugs/switch-button/js/bootstrap-switch.js"></script>
<script>
    $(document).ready(function(){
        $(".checkbox").bootstrapSwitch({
            onText:'是',
            offText:'否'
        });
        $('.is_top').on('switchChange.bootstrapSwitch', function (event,state){
            var val = state?1:0;
            var id = $(this).attr('data-id');
            $.post("{:url('top')}",{id:id,val:val},function (data) {
                if(data.code!=1){layer.msg('改变状态失败', {icon: 5, time: 2000});}
            });
        });
    });
    
    // function preview(url) {
    //     layer.open({
    //         type: 2,
    //         title: '视频预览',
    //         shadeClose: true,
    //         shade: false,
    //         maxmin: true, //开启最大化最小化按钮
    //         area: ['893px', '600px'],
    //         content: '//fly.layui.com/'
    //     });
    // }
    
    $(function () {

        $('.layout').hover(function () {
            var left = $(this).offset().left+$(this).children('a').width();
            var top = $(this).offset().top-60;
            $(this).append('<div class="ifrme"><iframe style="width: 100%;height: 100%;display: block;" frameborder="0"></iframe></div>');
            $('.ifrme').css({'top':top,'left':left}).show(300);
            $('.ifrme iframe').attr('src',$(this).children('a').attr('href'));
        },function () {
            $('.ifrme').remove();
        })


        var top   = "{:input('get.top')}";
        if(top != ''){
            $('#top'+top).attr('selected',true)
        }

        var status   = "{:input('get.status')}";
        if(status != ''){
            $('#status'+status).attr('selected',true)
        }
    })
</script>



{/block}



